package com.ps.weedingjumper.view;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.ps.weedingjumper.model.Player;

public class PlayerView extends Sprite {

	private Player player;
	private SpriteBatch batch;
	
	public PlayerView(Player player) {
		super(new Texture("player/mario2.png"));
		this.player = player;
		batch = new SpriteBatch();
		super.setSize(super.getWidth() * WorldView.SCALE, super.getHeight() * WorldView.SCALE);
	}
	
	public void render() {
		batch.begin();
		super.draw(batch);
		batch.end();
	}
	
	public void update() {
		super.setPosition(player.getX() * WorldView.SCALE, player.getY() * WorldView.SCALE);
	}
	
	public void dispose() {
		super.getTexture().dispose();
	}
	
	public Player getPlayer() {
		return player;
	}
	
	public void setPlayer(Player player) {
		this.player = player;
	}	
	
}
